package WhatGUI;

import java.awt.*;

public class WhatGUI {

	private Frame frame;
	public Button btn1,btn2,btn3;
	public TextArea ta;

	public WhatGUI(){
		frame = new Frame("タイトル");
		WhatDialog wd = new WhatDialog(frame, "終了");
		WhatListener wl = new WhatListener(this,wd);
		frame.addWindowListener(new WhatAdapter(wd));
		MenuBar mb = new MenuBar();
		Menu m1 = new Menu("コマンド");
		Menu m2 = new Menu("スタブ1");
		Menu m3 = new Menu("スタブ2");
		MenuItem mi1 = new MenuItem("出現");
		MenuItem mi2 = new MenuItem("クリア");
		MenuItem mi3 = new MenuItem("終了");
		MenuItem mi4 = new MenuItem("スタブ3");
		MenuItem mi5 = new MenuItem("スタブ4");
		MenuItem mi6 = new MenuItem("スタブ5");
		m1.add(mi1);
		m1.add(mi2);
		m1.addSeparator();
		m1.add(mi3);
		m2.add(mi4);
		m2.add(mi5);
		m3.add(mi6);
		mb.add(m1);
		mb.add(m2);
		mb.add(m3);
		frame.setMenuBar(mb);
		Label label = new Label("ラベル");
		btn1 = new Button("出現");
		btn1.addActionListener(wl);
		btn2 = new Button("クリア");
		btn2.addActionListener(wl);
		btn3 = new Button("終了");
		btn3.addActionListener(wl);
		ta = new TextArea();
		TextField tf = new TextField();
		Panel panel1 = new Panel();
		Panel panel2 = new Panel();
		panel1.setLayout(new GridLayout(1,3));
		panel2.setLayout(new BorderLayout());
		panel1.add(btn1);
		panel1.add(btn2);
		panel1.add(btn3);
		panel2.add(ta);
		panel2.add(tf,BorderLayout.SOUTH);
		frame.setLayout(new BorderLayout());
		frame.add(label,BorderLayout.NORTH);
		frame.add(panel2,BorderLayout.CENTER);
		frame.add(panel1,BorderLayout.SOUTH);
		frame.setSize(640, 480);
		frame.setLocation(100, 100);
		frame.setBackground(Color.cyan);
		frame.setVisible(true);
	}

	public void windowClose() {
		frame.dispose();
	}
	
	public static void main(String args[]){
		WhatGUI gui = new WhatGUI();
	}
}
